package team.you.ticket.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import team.you.ticket.pojo.Result;
import team.you.ticket.pojo.TrainNum;
import team.you.ticket.service.TicketService;

import javax.servlet.http.HttpServletRequest;
import java.util.Date;

@Controller
@RequestMapping("/payTicket")
public class PayTicketCtrl {
    @Autowired
    private TicketService ticketService;

    @RequestMapping("/add")
    @ResponseBody
    private Result add(String id,String carId,Date starTime,String starSite,Date endTime,String endSite, Double range,
                       Integer money,Integer popleNum,String type, String remarks, HttpServletRequest request)
    {
        TrainNum trainNum=new TrainNum(id,carId,starTime,starSite,endTime,endSite,range,money,popleNum,"");
        return ticketService.add(trainNum,type,remarks,request);
    }
}
